<template>
  <div>这是home页面 - {{ count }} - <button @click="fn">btn</button></div>
</template>

<script>
//todo 在setup里面，辅助函数不能用了
import { useStore } from "vuex";
import { computed } from "vue";
export default {
  setup() {
    const store = useStore();

    // const count = store.state.count;
    const count = computed(() => {
      return store.state.index.count;
    });

    const fn = () => {
      store.commit("index/add");
    };

    return { count, fn };
  },
};
</script>
